﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Delonix_Regia_Hotel_Management_System
{
    public partial class RatesPage : System.Web.UI.Page
    {
        static float a, c, d;

        static char b;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session["user"] == null)
                {
                    Response.Redirect("LoginPage.aspx");
                }
            }
        }

        protected void btn1_Click(object sender, EventArgs e)
        {

            if ((tbxDisplay.Text == "+") || (tbxDisplay.Text == "-") || (tbxDisplay.Text == "*") || (tbxDisplay.Text == "/"))
            {

                tbxDisplay.Text = "";

                tbxDisplay.Text = tbxDisplay.Text + btn1.Text;

            }

            else

                tbxDisplay.Text = tbxDisplay.Text + btn1.Text;

        }

        protected void btn2_Click(object sender, EventArgs e)
        {

            if ((tbxDisplay.Text == "+") || (tbxDisplay.Text == "-") || (tbxDisplay.Text == "*") || (tbxDisplay.Text == "/"))
            {

                tbxDisplay.Text = "";

                tbxDisplay.Text = tbxDisplay.Text + btn2.Text;

            }

            else

                tbxDisplay.Text = tbxDisplay.Text + btn2.Text;

        }

        protected void btn3_Click(object sender, EventArgs e)
        {

            if ((tbxDisplay.Text == "+") || (tbxDisplay.Text == "-") || (tbxDisplay.Text == "*") || (tbxDisplay.Text == "/"))
            {

                tbxDisplay.Text = "";

                tbxDisplay.Text = tbxDisplay.Text + btn3.Text;

            }

            else

                tbxDisplay.Text = tbxDisplay.Text + btn3.Text;

        }

        protected void btn4_Click(object sender, EventArgs e)
        {

            if ((tbxDisplay.Text == "+") || (tbxDisplay.Text == "-") || (tbxDisplay.Text == "*") || (tbxDisplay.Text == "/"))
            {

                tbxDisplay.Text = "";

                tbxDisplay.Text = tbxDisplay.Text + btn4.Text;

            }

            else

                tbxDisplay.Text = tbxDisplay.Text + btn4.Text;

        }

        protected void btn5_Click(object sender, EventArgs e)
        {

            if ((tbxDisplay.Text == "+") || (tbxDisplay.Text == "-") || (tbxDisplay.Text == "*") || (tbxDisplay.Text == "/"))
            {

                tbxDisplay.Text = "";

                tbxDisplay.Text = tbxDisplay.Text + btn5.Text;

            }

            else

                tbxDisplay.Text = tbxDisplay.Text + btn5.Text;

        }

        protected void btn6_Click(object sender, EventArgs e)
        {

            if ((tbxDisplay.Text == "+") || (tbxDisplay.Text == "-") || (tbxDisplay.Text == "*") || (tbxDisplay.Text == "/"))
            {

                tbxDisplay.Text = "";

                tbxDisplay.Text = tbxDisplay.Text + btn6.Text;

            }

            else

                tbxDisplay.Text = tbxDisplay.Text + btn6.Text;

        }

        protected void btn7_Click(object sender, EventArgs e)
        {

            if ((tbxDisplay.Text == "+") || (tbxDisplay.Text == "-") || (tbxDisplay.Text == "*") || (tbxDisplay.Text == "/"))
            {

                tbxDisplay.Text = "";

                tbxDisplay.Text = tbxDisplay.Text + btn7.Text;

            }

            else

                tbxDisplay.Text = tbxDisplay.Text + btn7.Text;

        }



        protected void btn8_Click(object sender, EventArgs e)
        {

            if ((tbxDisplay.Text == "+") || (tbxDisplay.Text == "-") || (tbxDisplay.Text == "*") || (tbxDisplay.Text == "/"))
            {

                tbxDisplay.Text = "";

                tbxDisplay.Text = tbxDisplay.Text + btn8.Text;

            }

            else

                tbxDisplay.Text = tbxDisplay.Text + btn8.Text;

        }



        protected void btn9_Click(object sender, EventArgs e)
        {

            if ((tbxDisplay.Text == "+") || (tbxDisplay.Text == "-") || (tbxDisplay.Text == "*") || (tbxDisplay.Text == "/"))
            {

                tbxDisplay.Text = "";

                tbxDisplay.Text = tbxDisplay.Text + btn9.Text;

            }

            else

                tbxDisplay.Text = tbxDisplay.Text + btn9.Text;

        }



        protected void btn0_Click(object sender, EventArgs e)
        {

            if ((tbxDisplay.Text == "+") || (tbxDisplay.Text == "-") || (tbxDisplay.Text == "*") || (tbxDisplay.Text == "/"))
            {

                tbxDisplay.Text = "";

                tbxDisplay.Text = tbxDisplay.Text + btn0.Text;

            }

            else

                tbxDisplay.Text = tbxDisplay.Text + btn0.Text;

        }



        protected void btnAdd_Click(object sender, EventArgs e)
        {

            a = Convert.ToInt32(tbxDisplay.Text);

            tbxDisplay.Text = "";

            b = '+';

            tbxDisplay.Text += b;

        }

        protected void btnSubtract_Click(object sender, EventArgs e)
        {

            a = Convert.ToInt32(tbxDisplay.Text);

            tbxDisplay.Text = "";

            b = '-';

            tbxDisplay.Text += b;

        }

        protected void btnMultiply_Click(object sender, EventArgs e)
        {

            a = Convert.ToInt32(tbxDisplay.Text);

            tbxDisplay.Text = "";

            b = '*';

            tbxDisplay.Text += b;

        }

        protected void btnDivide_Click(object sender, EventArgs e)
        {

            a = Convert.ToInt32(tbxDisplay.Text);

            tbxDisplay.Text = "";

            b = '/';

            tbxDisplay.Text += b;

        }

        protected void btnEqual_Click(object sender, EventArgs e)
        {

            c = Convert.ToInt32(tbxDisplay.Text);

            tbxDisplay.Text = "";

            if (b == '/')
            {

                d = a / c;

                tbxDisplay.Text += d;

                a = d;

            }

            else if (b == '+')
            {

                d = a + c;

                tbxDisplay.Text += d;

                a = d;

            }

            else if (b == '-')
            {

                d = a - c;

                tbxDisplay.Text += d;

                a = d;

            }

            else
            {

                d = a * c;

                tbxDisplay.Text += d;

                a = d;

            }



        }


        protected void btnClear_Click(object sender, EventArgs e)
        {

            tbxDisplay.Text = "";

        }

        protected void btnAdmin_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("AdminMainPage.aspx");
        }

        protected void btnCheckIn_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("CheckInPage.aspx");
        }

        protected void btnCheckOut_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("CheckOutPage.aspx");
        }

        protected void btnQuery_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("QueryPage.aspx");
        }

        protected void btnBooking_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("RoomAvailabilityPage.aspx");
        }

        protected void btnRates_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("RatesPage.aspx");
        }

        protected void btnStaff_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("StaffMainPage.aspx");
        }

        protected void btnReport_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("ReportPage.aspx");
        }

        protected void btnLogout_Click(object sender, ImageClickEventArgs e)
        {
            Session["user"] = null;
            Response.Redirect("LoginPage.aspx");
        }

        protected void btnLogo_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("WelcomePage.aspx");
        }
    }
}